pp108 : Claim Task

Claim Task

This method is used by users, to claim a task which is assigned to their team on the work list.

Resource URI
/v1/tasks/claimTask
Request Type

HTTP POST

HTTP Header Parameters

Parameter

Description

Accepted Input Values

SAMLart

The SAML artifact received after authentication. For more information on how to authenticate, see Login.
otdsticket The OTDSTicket received after authentication from OTDS. The OTDSTicket must be provided as a header parameter. For more information on how to authenticate, see Login.

Note : You must provide either SAMLart or otdsticket header parameter. If you provide both the header parameters, it will internally work based on SAMLart. 

 

Note: The supported output formats are:

  • JSON
  • XML
Request Parameters

Parameter

Description

Accepted Input Values

taskId

Contains the unique identifier of the task. This is the path parameter.   

For example: 
taskId: 002481F0-8E9F-11E3-FB98-BD04D5FA7BB1
Sample HTTP Payload

POST accepts the payload content only in the XML format as follows:

Sample Client Example
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <ClaimTask xmlns="http://schemas.cordys.com/notification/workflow/1.0">
 <TaskId>002481F0-8E9F-11E3-FE11-E11AB5FED7E1</TaskId>
 <TaskId>002481F0-8E9F-11E3-FE11-D73AAB06B7E1</TaskId> 
 </ClaimTask>

Add the HTTP Payload as follows:

public static void main(String[] args) throws JAXBException,ClientProtocolException, IOException {

com.cordys.entity.bean.ClaimTask claim = new com.cordys.entity.bean.ClaimTask();
 claim.setTaskId("002481F0-8E9F-11E3-FE11-E11AB5FED7E1");
 claim.setTaskId("002481F0-8E9F-11E3-FE11-D73AAB06B7E1");
StringWriter writer = new StringWriter();
 JAXBContext jaxbContext = JAXBContext.newInstance(com.cordys.entity.bean.ClaimTask.class);
 Marshaller jaxbMarshaller = jaxbContext.createMarshaller();
 jaxbMarshaller.marshal(claim, writer); 
 
 DefaultHttpClient httpClient = new DefaultHttpClient();
 // Define a postRequest request
 HttpPost postRequest = new HttpPost("http://<HOST>:<POST>/BPMService/v1/tasks/claimTask");
 
 // Set the request post body
 StringEntity userEntity = new StringEntity(writer.getBuffer().toString());
 postRequest.setEntity(userEntity);
// Set the API media type in http content-type and Other header 
 
 //postRequest.addHeader("SAMLart","MDEUkKOCWs8vQY+gYqa28mHjKoN0V+gJI8/zKxA4BveCdAA/LA+COJau");
 postRequest.addHeader("otdsticket","ADD5mjXAluA8bwHq8NTq8EmEnrsS");
 postRequest.addHeader("content-type", "application/xml");
// Send the request; It will immediately return the response in
 // HttpResponse object if any
 HttpResponse response = httpClient.execute(postRequest);  ...
}

Note: The com.cordys.entity.bean.ClaimTaskobject structure has been attached below, which is expected as a parameter of the REST API:

public Response claimTask( com.cordys.entity.bean.ClaimTask)

ClaimTask.java class is packed on BPMServiceClient.jar.

Attachments: